<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
</body>
<script>
    let rh=[9,5,6,7,2,3,4];
    for(let i=1;i<rh.length;i++){  //控制轮数
        for(let n=0;n<rh.length-i;n++){   //  控制每轮的次数
            if(rh[n]>rh[n+1]){
               let hao=rh[n];
                rh[n]=rh[n+1];
                rh[n+1]=hao;
            }  
        }
    }
    console.log(rh);
</script>
</html>